package org.charmsoft.files;

import freemarker.template.Configuration;
import freemarker.template.Template;

import java.io.IOException;

/**
 * @ Author: Allen J L Chen
 * This Class is to
 * 6/4/2025
 **/
public class DefaultFreemarkerLoader implements FreemarkerLoader {

    @Override
    public Template loadTemplate(String name) {
        Configuration ctf = new Configuration();
        ctf.setClassForTemplateLoading(this.getClass(), "/freemarker");
        Template template;

        try {
            template = ctf.getTemplate(name);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return template;
    }

}
